import { createRouter, createWebHistory } from 'vue-router'
import ChatLayout from '../views/ChatLayout.vue'

const routes = [
  {
    path: '/',
    redirect: '/chat'
  },
  {
    path: '/chat',
    component: ChatLayout,
    children: [
      {
        path: '',
        name: 'new-chat',
        component: () => import('../views/ChatView.vue')
      },
      {
        path: ':chatId',
        name: 'chat-detail',
        component: () => import('../views/ChatView.vue'),
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router